// 文件路径: app/layout.tsx
import type React from "react";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { Navbar } from "@/components/navbar";
import { Sidebar } from "@/components/sidebar";
import { ThemeProvider } from "@/components/theme-provider";
import ConditionalLayout from "@/components/conditional-sidebar"; // 导入客户端组件

// const inter = Inter({ subsets: ["latin"] });

// 修改元数据
export const metadata: Metadata = {
    title: "大学课堂实时监测系统",
    description: "实时监测大学课堂教学情况，提高教学效率",
    generator: "v0.dev",
};

export default function RootLayout({
                                       children,
                                   }: Readonly<{
    children: React.ReactNode;
}>) {
    return (
        <html lang="zh-CN" suppressHydrationWarning={true}>
        <body >
        {/* 使用 ThemeProvider 包裹整个应用 */}
        <ThemeProvider
            attribute="class"
            defaultTheme="light"
            enableSystem
            disableTransitionOnChange
        >
            <div className="flex min-h-screen flex-col">
                {/* 条件渲染 Navbar 和 Sidebar */}
                <ConditionalLayout>
                    {/* 主内容 */}
                    <main className="flex-1 overflow-y-auto bg-gray-50 p-4 md:p-6">
                        {children}
                    </main>
                </ConditionalLayout>
            </div>
        </ThemeProvider>
        </body>
        </html>
    );
}